package com.jgdt.jgdtkasannong_university_gene_backend.service.base.impl;


import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jgdt.jgdtkasannong_university_gene_backend.entity.base.CameraDeviceChannel;
import com.jgdt.jgdtkasannong_university_gene_backend.mapper.base.CameraDeviceChannelMapper;
import com.jgdt.jgdtkasannong_university_gene_backend.service.base.CameraDeviceChannelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 设备序列通道信息表 服务实现类
 * </p>
 *
 * @author chenzg
 * @since 2025-05-16
 */
@Service
@Slf4j
public class CameraDeviceChannelServiceImpl extends ServiceImpl<CameraDeviceChannelMapper, CameraDeviceChannel> implements CameraDeviceChannelService {


    @Override
    public void saveBatchChannelByDeviceList(List<CameraDeviceChannel> cameraDeviceChannelList) {
        this.saveBatch(cameraDeviceChannelList);
    }

    @Override
    public List<CameraDeviceChannel> getChannelBySequence(List<Integer> sequenceIds) {
        if(CollectionUtil.isEmpty(sequenceIds)){
            return new ArrayList<>();
        }
        LambdaQueryWrapper<CameraDeviceChannel> queryWrapper=new LambdaQueryWrapper<>();
        queryWrapper.in(CameraDeviceChannel::getSequenceId,sequenceIds);
        return this.list(queryWrapper);
    }
}
